

#import "DayButton.h"


@implementation DayButton
@synthesize delegate, buttonDate;



- (instancetype)initWithFrame:(CGRect)frame
{
//    self = [DayButton buttonWithType:UIButtonTypeCustom];
    self = (DayButton *)[super initWithFrame:frame];
    self.frame = frame;
    self.titleLabel.textAlignment = UITextAlignmentRight;
    self.backgroundColor = [UIColor clearColor];
    [self setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    
    [self addTarget:delegate action:@selector(dayButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
    
    return self;

}

- (void)layoutSubviews {
	[super layoutSubviews];
	
	UILabel *titleLabel = [self titleLabel];
	CGRect labelFrame = titleLabel.frame;
	int framePadding = 4;
	labelFrame.origin.x = self.bounds.size.width - labelFrame.size.width - framePadding;
	labelFrame.origin.y = framePadding;
	
	[self titleLabel].frame = labelFrame;
}


@end
